<template>

  <div id='tNo'>
    {{$attrs.tNo}}
    <comTable
      :column="column"
      :tableData="tableData"
      :pageSize="pageSize"
      :pageSizes="pageSizes"
      :currentPage="currentPage"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    ></comTable>
  </div>
</template>

<script>
import { coursePlan } from "@/api/course"
import comTable from "@/components/common/comTable.vue"

export default {
  name: 'tNo',
  components: { comTable },
  data() {
    return {
      // 使用路由传参
      //   sNo: 0
      column: [
        { label: '教工号', prop: 'tno', sortable: true },
        { label: '名称', prop: 'tname' },
        { label: '课程号', prop: 'cno', sortable: true },
        { label: '课程名称', prop: 'cname', },
        { label: '上课地点', prop: 'cplace', },
        { label: '上课时间', prop: 'ctime' },
        // { label: '操作', prop: 'operate', type: 'slot', slot_name: "slot_operate" },
      ],
      tableData: [],
      pageSize: 8,
      pageSizes: [8, 16, 24, 32],
      currentPage: 1,
      total: 0,
    }
  },
  activated() {
    // console.log("2313", this.$attrs.tno);
    coursePlan(this.currentPage, this.pageSize, this.$attrs.tno).then(res => {
      // console.log("2313", res);
      this.tableData = res.data.data.course.list
      this.total = res.data.data.course.total
    })
  },
  methods: {
    handleSizeChange(size) {
      this.pageSize = size
    },
    handleCurrentChange(currentPage) {
      this.currentPage = currentPage
    }
  }
};
</script>
<style>
</style>
